package dd.prog2.exercises.set07;

public class CylindricalTank extends Tank{

	private double r, length;

	public CylindricalTank(double r, double length) {
		this.r = r;
		this.length = length;
		this.setType("Cylindrical");
	}

	@Override
	public double calcSurface() {
		return 2*pi*r*(r+length);
	}

	@Override
	public double calcVolume() {
		return pi*r*r*length;
	}

	public double getR() {
		return r;
	}
	public void setR(double r) {
		this.r = r;
	}

	public double getLength() {
		return length;
	}

	public void setLength(double length) {
		this.length = length;
	}

	@Override
	public String toString() {
		String res = "Cylindrical Tank:\n";
		res += this.getType()+". Surface: "+df.format(this.calcSurface())+". Volume: "+df.format(this.calcVolume())+"\n";
		return res;
	}

	@Override
	protected CylindricalTank clone() throws CloneNotSupportedException {
		CylindricalTank t = new CylindricalTank(this.r, this.length);
		return t;
	}

}
